class Eskill extends AcGameObject {
    constructor(playground, color, player) {
        super();
        this.playground = playground;
        this.player = player;
        this.ctx = this.playground.game_map.ctx2;
        this.x = this.ctx.canvas.width * 7 / 10;
        this.y = this.ctx.canvas.height / 2;
        this.radius = this.y;
        this.color = color;
        this.eps = 0.1;
        this.spent_time = 0;
    }

    start() {
        this.ctx.beginPath();
        this.ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);
        this.ctx.closePath();
        this.ctx.fillStyle = this.color;
        this.ctx.fill();
    }

    update() {
        
        this.spent_time += this.timedelta / 1000;

        this.render();
    }

    render() {
        let angle = Math.PI * 2, color_ball = this.color;
        if(!this.player.my_big_skill){
            color_ball = 'grey';
        }
        // console.log(angle);
        this.ctx.beginPath();
        this.ctx.arc(this.x, this.y, this.radius, -Math.PI / 2, angle - Math.PI / 2);
        this.ctx.closePath();
        this.ctx.fillStyle = color_ball;
        this.ctx.fill();


        this.ctx.fillStyle = '#000'; // 设置文字颜色;
        this.ctx.font = '25px Arial'; // 设置文字大小和字体
        this.ctx.textAlign = 'center'; // 文字居中对齐
        this.ctx.textBaseline = 'middle'; // 文字垂直居中对齐
        this.ctx.fillText('E', this.x, this.y);
    }
}
